<template>
	<!-- <van-radio-group v-model="radioResult" @change='handleChange' class="tanxin">
	            <van-radio v-for='ele in list' :key='ele.value' :name="ele.name" @click="handleClick" style="width: 50%;">
	              {{ele.value}}
	            </van-radio>
	          </van-radio-group> -->
	<view class="uni-checkbox">
		<uniDataCheckbox mode="list" icon="right" v-model="chooseValue" :localdata="list" @change="handleClick" >{{ele.value}}
		</uniDataCheckbox>
	</view>
</template>

<script setup>
	import {
		defineProps,
		ref,
		defineEmits,
    watch
	} from "vue"
	import uniDataCheckbox from "@/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue"
	const emit = defineEmits(['getCheckData'])
	const props = defineProps({
		list: {
			type: Array,
			default: []
		},
		modelValue:{
			type:String,
			default:""
		}
	})
	const chooseValue = ref(null)

	watch(() => props.modelValue,(newval,oldval) => {
		if(newval!=oldval){
			chooseValue.value = newval;
		}
	},{ immediate: true, deep: true });


	function handleClick(event) {
		if(event.detail.value){
			console.log(event.detail.value)
			emit("getCheckData", event.detail.value)
		}

	}


</script>

<style scoped lang="less">
	.uni-checkbox {
		padding: 0 20rpx;
		margin-bottom: 30rpx;
	}
</style>
